package com.hkyp.ss.course.apis.enumu;


import java.util.Objects;

/**
 * 启用禁用枚举
 */
public enum EnableEnum {
    ENABLE(10,"启用"),
    DISABLE(20,"禁用")
    ;
    private Integer code;
    private String displayName;

    EnableEnum(Integer code, String displayName) {
        this.code = code;
        this.displayName = displayName;
    }

    public static EnableEnum getUserStatusEnum(Integer code) {
        for (EnableEnum c : EnableEnum.values()) {
            if (Objects.equals(code,c.getCode())) {
                return c;
            }
        }
        return null;
    }

    public static String getUserStatusName(Integer code) {
        for (EnableEnum c : EnableEnum.values()) {
            if (Objects.equals(code,c.getCode())) {
                return c.getDisplayName();
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }
}
